package com.example.demo.controller;

import com.example.demo.common.R;
import com.example.demo.decorator.Authorize;
import com.example.demo.service.AiChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ai-chat")
public class AiChatController {
    @Autowired
    private AiChatService aiChatService;

    @GetMapping("/{titleId}")
    @Authorize(
            permission = "main::aiChat",
            label = "ai对话"
    )
    public R<String> aiChat(@PathVariable Integer titleId) {
        return aiChatService.aiChat(titleId);
    }
}
